from tensorflow.keras.applications import ResNet50
import numpy as np
from helper import ModelOptimizer,OptimizedModel # using the helper from <URL>

model_dir = './data/resnet50'
model = ResNet50(include_top=True, weights="./data/resnet50_saved_model/resnet50_weights_tf_dim_ordering_tf_kernels.h5")
model.save(model_dir)

BATCH_SIZE = 32
dummy_input_batch = np.zeros((BATCH_SIZE, 224, 224, 3))
PRECISION = "FP32" # Options are "FP32", "FP16", or "INT8"
opt_model = ModelOptimizer(model_dir)
opt_model.convert(model_dir+'_FP32', precision=PRECISION)
model_fp32 = OptimizedModel(model_dir+'_FP32')
model_fp32.predict(dummy_input_batch)